XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
Go to the documentation of this file.
21#include <gtest/gtest.h>
68 return std::getenv(
"DASHBOARD_TEST_FROM_CTEST") != NULL;
75#define EXPECT_MATRIX_APPROX(C_expect, C_actual, precision) \
76 EXPECT_PRED2([](const Eigen::MatrixXd& lhs, \
77 const Eigen::MatrixXd& rhs) { return (lhs - rhs).isMuchSmallerThan(1, precision); }, \
81#define ASSERT_MATRIX_APPROX(C_expect, C_actual, precision) \
82 ASSERT_PRED2([](const Eigen::MatrixXd& lhs, \
83 const Eigen::MatrixXd& rhs) { return (lhs - rhs).isMuchSmallerThan(1, precision); }, \
87#define EXPECT_QUATERNION_APPROX(C_expect, C_actual, precision) \
88 EXPECT_PRED2([](const Eigen::Quaterniond& lhs, \
89 const Eigen::Quaterniond& rhs) { return lhs.angularDistance(rhs) < precision; }, \
93#define ASSERT_QUATERNION_APPROX(C_expect, C_actual, precision) \
94 ASSERT_PRED2([](const Eigen::Quaterniond& lhs, \
95 const Eigen::Quaterniond& rhs) { return lhs.angularDistance(rhs) < precision; }, \
99#define EXPECT_QUATERNION_VECTOR_APPROX(C_expect, C_actual, precision) \
101 [](const Eigen::VectorXd& lhs, const Eigen::VectorXd& rhs) { \
102 return Eigen::Quaterniond(Eigen::Vector4d(lhs)) \
103 .angularDistance(Eigen::Quaterniond(Eigen::Vector4d(rhs))) < precision; \
108#define ASSERT_QUATERNION_VECTOR_APPROX(C_expect, C_actual, precision) \
110 [](const Eigen::VectorXd& lhs, const Eigen::VectorXd& rhs) { \
111 return Eigen::Quaterniond(Eigen::Vector4d(lhs)) \
112 .angularDistance(Eigen::Quaterniond(Eigen::Vector4d(rhs))) < precision; \
117#define EXPECT_POSE2d_APPROX(C_expect, C_actual, precision) \
119 [](const Eigen::VectorXd& lhs, const Eigen::VectorXd& rhs) { \
120 assert(lhs.size() == 3 and rhs.size() == 3); \
121 Eigen::VectorXd er = lhs - rhs; \
122 er(2) = remainder((double)er(2), 2 * M_PI); \
123 return er.isMuchSmallerThan(1, precision); \
128#define ASSERT_POSE2d_APPROX(C_expect, C_actual, precision) \
130 [](const Eigen::VectorXd& lhs, const Eigen::VectorXd& rhs) { \
131 assert(lhs.size() == 3 and rhs.size() == 3); \
132 Eigen::VectorXd er = lhs - rhs; \
133 er(2) = remainder((double)er(2), 2 * M_PI); \
134 return er.isMuchSmallerThan(1, precision); \
139#define EXPECT_POSE3d_APPROX(C_expect, C_actual, precision) \
141 [](const Eigen::VectorXd& lhs, const Eigen::VectorXd& rhs) { \
142 assert(lhs.size() == 7 and rhs.size() == 7); \
143 Eigen::Vector4d er; \
144 er.head(3) = lhs.head(3) - rhs.head(3); \
145 er(3) = Eigen::Quaterniond(Eigen::Vector4d(lhs.tail(4))) \
146 .angularDistance(Eigen::Quaterniond(Eigen::Vector4d(rhs.tail(4)))); \
147 return er.isMuchSmallerThan(1, precision); \
152#define ASSERT_POSE3d_APPROX(C_expect, C_actual, precision) \
154 [](const Eigen::VectorXd& lhs, const Eigen::VectorXd& rhs) { \
155 assert(lhs.size() == 7 and rhs.size() == 7); \
156 Eigen::Vector4d er; \
157 er.head(3) = lhs.head(3) - rhs.head(3); \
158 er(3) = Eigen::Quaterniond(Eigen::Vector4d(lhs.tail(4))) \
159 .angularDistance(Eigen::Quaterniond(Eigen::Vector4d(rhs.tail(4)))); \
160 return er.isMuchSmallerThan(1, precision); \
Definition: utils_gtest.h:72
bool is_running_under_ctest()
Checks if the code is running under CTest Useful to avoid launching visualizers and other interactive...
Definition: utils_gtest.h:65